<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <div id="app">
      <h2>{{msg|format(' niu')}}</h2>
      <h2>{{msg|format(' bi')}}</h2>
  </div>
  <div id="app2">
      <h1>{{msg | change(' ')}}</h1>
      <h1>{{msg1 | change(' ')}}</h1>
  </div>
  <script src="./vue.js"></script>
  <script>
      Vue.filter('format',function(val,data){
        return val + data + ' !!!'
      })

    var vm = new Vue({
      el:'#app',
      data:{
          msg:"hello vue"
      },
      methods:{
      }
     });

     new Vue({
         el:'#app2',
         data:{
             msg:"moring!",
             msg1:''
         },
         filters:{
             change: function(val,data){
                if(!val) return '没有需要过滤的值'

                 return val + data +'weigegood'
             }
         }
     })
  </script>
</body>
</html>
